package com.xywy.wjk;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.xywy.R;
import com.xywy.common.BaseActivity;
import com.xywy.common.app.MainApplication;
import com.xywy.common.widget.TitleBar2;
import com.xywy.wjk.observer.ObserverConstants;

/**
 * @ClassName: DeviceTypeAddActivity
 * @Package com.xywy.wjk
 * @Description: 按设备类型添加
 * @author CodeMonkeyCui
 * @date 2014年10月27日 下午4:39:07
 * @version V1.0
 */
public class DeviceTypeAddActivity extends BaseActivity implements
		OnClickListener {

	private TitleBar2 titleBar;
	private TextView tvBack;
	private TextView tvGo;
	private TextView tvTitle;
	private RelativeLayout rlThermometer;
	private RelativeLayout rlWeight;
	private RelativeLayout rlBloodPresure;
	private RelativeLayout rlBloodSugar;
	private TextView tv_weight;
	private TextView tv_blood_pressure;
	private TextView tv_blood_sugar;
	private TextView tv_thermometer;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		// 设置为全屏
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_device_type_add);
		initView();
		MainApplication.addSpeciall(this);

	}

	@Override
	public void preInit() {

		// TODO Auto-generated method stub

	}

	@Override
	public void loadData() {
		// TODO Auto-generated method stub

	}

	@Override
	public void initView() {
		// TODO Auto-generated method stub
		titleBar = (TitleBar2) findViewById(R.id.activity_device_type_add_title);
		tvTitle = titleBar.getTitle();
		tvTitle.setText(getString(R.string.device_type_add));
		tvBack = titleBar.getTvBack();
		tvBack.setText(getString(R.string.tv_start_back));
		tvBack.setOnClickListener(this);
		tvGo = titleBar.getGo();
		tvGo.setVisibility(View.GONE);

		rlWeight = (RelativeLayout) findViewById(R.id.rl_weight);
		rlWeight.setOnClickListener(this);
		rlBloodPresure = (RelativeLayout) findViewById(R.id.rl_blood_presure);
		rlBloodPresure.setOnClickListener(this);
		rlBloodSugar = (RelativeLayout) findViewById(R.id.rl_blood_sugar);
		rlBloodSugar.setOnClickListener(this);
		rlThermometer = (RelativeLayout) findViewById(R.id.rl_thermometer);
		rlThermometer.setOnClickListener(this);
		tv_weight = (TextView) findViewById(R.id.tv_weight);
		tv_blood_pressure = (TextView) findViewById(R.id.tv_blood_pressure);
		tv_blood_sugar = (TextView) findViewById(R.id.tv_blood_sugar);
		tv_thermometer = (TextView) findViewById(R.id.tv_thermometer);

	}

	@Override
	public void onClick(View view) {
		// TODO Auto-generated method stub
		switch (view.getId()) {
		case R.id.tv_title_back:
			this.finish();
			break;
		case R.id.rl_weight:
			Intent weightIntent = new Intent(this, SelectBrandActivity.class);
			weightIntent.putExtra("deviceType", tv_weight.getText().toString());
			startActivity(weightIntent);
			break;
		case R.id.rl_blood_presure:
			Intent bpIntent = new Intent(this, SelectBrandActivity.class);
			bpIntent.putExtra("deviceType", tv_blood_pressure.getText()
					.toString());
			startActivity(bpIntent);
			break;
		case R.id.rl_blood_sugar:
			Intent bsIntent = new Intent(this, SelectBrandActivity.class);
			bsIntent.putExtra("deviceType", tv_blood_sugar.getText().toString());
			startActivity(bsIntent);
			break;
		case R.id.rl_thermometer:
			Intent tIntent = new Intent(this, SelectBrandActivity.class);
			tIntent.putExtra("deviceType", tv_thermometer.getText().toString());
			startActivity(tIntent);
			break;

		}

	}
}
